/*
 * Created by Administrator on 2017/3/31.
 */

var DatePicker = require('../../../../src/libs/date-picker');
var DatePickerSearch = React.createClass({
    getDefaultProps: function() {
        return{
            startTime:'',
            endTime:'',
            label:'时间',
            connect:'至',
            onChange:''

        }
    },
    componentDidMount:function(){

    },
    onChange: function () {
        var start = this.refs.startTime.getValue();
        var end = this.refs.endTime.getValue();
        this.props.onChange && this.props.onChange(start,end);
    },
    render: function () {
        return (
            <div className="form-group">
                <label>{this.props.label}</label>
                <div className="input">
                    <DatePicker ref="startTime"  onchange={this.onChange.bind(this)}  className="input-control w170 bg-icon" curDate={this.props.startTime}/>
                    <span className=" middle">{this.props.connect}</span>
                    <DatePicker ref="endTime" onchange={this.onChange.bind(this)} type="text" className="input-control w170 bg-icon" curDate={this.props.endTime}/>
                </div>
            </div>
        )
    }
})

module.exports = DatePickerSearch;